﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sitecore.Data.Items;

namespace Workflow.Alerts.Sublayouts
{
    public partial class Reject : BaseControl, IRejectView
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            PresentationManager.RegisterView(typeof(RejectViewPresenter), this, new WebSessionProvider());
            if (!IsPostBack && RejectLoad != null)
                RejectLoad();
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (RejectSave != null)
                RejectSave();

            phClose.Visible = true;
        }

        #region IRejectView Members

        public string Comments
        {
            get
            {
                return txtComments.Text;
            }
            set
            {
                txtComments.Text = value;
            }
        }

        public int AlertId
        {
            get { return Int32.Parse(Request.QueryString["alertId"]); }
        }

        public event OnRejectLoad RejectLoad;

        public event OnRejectSave RejectSave;

        #endregion
    }
}